import java.util.Arrays;

public class TestDemo1 {
    public static String adjust(int[] arr){
        int count1 = 0;
        int[] ret1 = new int[count1];
        int count2 = 0;
        int[] ret2 = new int[count2];
        for(int i = 0; i < arr.length; i++){
            if(arr[i] % 2 != 0){
                count1++;
                ret1 = Arrays.copyOf(ret1, count1);
                ret1[count1-1] = arr[i];
            }else{
                count2++;
                ret2 = Arrays.copyOf(ret2, count2);
                ret2[count2-1] = arr[i];
            }
        }
        return Arrays.toString(ret1) + Arrays.toString(ret2);
    }
    public static void main(String[] args) {
        int[] arr = {1,2,3,4,5,6};
        System.out.println(Arrays.toString(arr));
        String str = adjust(arr);
        System.out.println(str);
    }
}
